//
//  NewFeiLvViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/3/30.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewFeiLvViewController.h"
#import "JTCSM.h"
#import "NewFeiLvTableViewCell.h"
@interface NewFeiLvViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) NSMutableArray *titlearray;
@property (nonatomic,strong) UITableView *tableview;
@property (nonatomic,strong) NSMutableArray *datascoure;

@end

@implementation NewFeiLvViewController

- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBar.hidden = NO;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [df isRemoveTarbar:YES];
    self.navigationController.navigationBar.hidden = NO;
    self.view.backgroundColor =RGBACOLOR(241, 241, 241, 1);
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    // Do any additional setup after loading the view.
    [self layoutTableView];
}
- (void)layoutTableView{
    [df newlineViewWithHeightofTop:10 superView:self.view  spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:10];
    _datascoure = @[@"我的费率_微信.png",@"我的费率_云闪付.png",@"我的费率_支付宝.png",@"我的费率_QQ.png",@"我的费率_京东.png"].mutableCopy;
    _tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 10, KCONTROLLERWith, KCONTROLLERHeight-10) style:UITableViewStylePlain];
    _tableview.backgroundColor = RGBACOLOR(241, 241, 241, 1);
    _tableview.delegate = self;
    _tableview.dataSource = self;
    [self.view addSubview:_tableview];
    _tableview.separatorStyle = UITableViewCellSeparatorStyleNone;
   
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return _datascoure.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    NSString *cellid = [NSString stringWithFormat:@"textfield%ld",(long)indexPath.row];
    NewFeiLvTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellid];
    if (cell == nil) {
        cell = [[NewFeiLvTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellid];
    }
    [cell setValueWithModel:indexPath];
    cell.logoImageV.image = [UIImage imageNamed:_datascoure[indexPath.row]];
    return cell;
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 80;
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 50;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    UIView *headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, KCONTROLLERWith, 50)];
    headerView.backgroundColor = [UIColor whiteColor];
    
    NSArray *titleArray = @[@"支付产品",@"结算方式",@"交易费率",@"会员返利"];
    for (int i = 0; i<titleArray.count; i++) {
        UILabel *label = [UILabel initWithFrame:CGRectMake(KCONTROLLERWith/4*i, 0, KCONTROLLERWith/4, headerView.LC_height) text:titleArray[i] font:13 textAlignment:NSTextAlignmentCenter texcolor:[df colorWithHexString:@"666666" alpha:1] backgroundColor:nil];
        [headerView addSubview:label];
    }
    
    [df newlineViewWithHeightofTop:headerView.LC_height superView:headerView spacing:0 color:RGBACOLOR(241, 241, 241, 1) lineHeight:1];
    return headerView;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
}


@end
